//
//  XMGUserCell.m
//  BuDeJie19
//
//  Created by hjj on 2016/12/3.
//  Copyright © 2016年 hjjuny. All rights reserved.
//
#import "XMGUserCell.h"
#import <UIImageView+WebCache.h>
#import "XMGUserItem.h"
@interface XMGUserCell ()
@property (weak, nonatomic) IBOutlet UIImageView *iconView;
@property (weak, nonatomic) IBOutlet UILabel *nameView;
@property (weak, nonatomic) IBOutlet UILabel *numView;
@end

@implementation XMGUserCell

- (void)setUser:(XMGUserItem *)user
{
    _user = user;
    
    [_iconView sd_setImageWithURL:[NSURL URLWithString:user.header] placeholderImage:[UIImage imageNamed:@"defaultUserIcon"]];
    
    _nameView.text = user.screen_name;
    
    // 处理订阅数字
    CGFloat num = [user.fans_count floatValue];
    
    NSString *numStr = [NSString stringWithFormat:@"%@人关注",user.fans_count];
    if (num > 10000) {
        num = num / 10000.0;
        numStr = [NSString stringWithFormat:@"%.1f万人关注",num];
        numStr = [numStr stringByReplacingOccurrencesOfString:@".0" withString:@""];
    }
    
    _numView.text = numStr;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
